/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SaleManager.View;

import data.pojo.Book;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author Kite
 */
public class TableModelFactory {

    public static Vector<String> BOOK_COLUMN_NAMES = new Vector(Arrays.asList("ISBN", "标题", "作者", "价格","出版社" ,"出版日期"));
    public static Vector<String> CATEGORY_COLUMN_NAMES = new Vector(Arrays.asList("图书类别名称"));
    public static Vector<String> ORDER_COLUMN_NAMES = new Vector(Arrays.asList("订单号","购买时间", "顾客","金额", "收件人","收件地址","邮编", "订单状态"));
    public static Vector<String> CUSTOMER_COLUMN_NAMES = new Vector(Arrays.asList("姓名", "编号", "积分", "生日"));

    public static DefaultTableModel getAddBookModel() {
        return new MyTableModel(null, BOOK_COLUMN_NAMES);
    }
    
    public static DefaultTableModel getCategoryModel() {
        return new MyTableModel(null, CATEGORY_COLUMN_NAMES);
    }

    public static DefaultTableModel getOrderModel() {
        return new MyTableModel(null, ORDER_COLUMN_NAMES);
    }

    public static DefaultTableModel getCustomerModel() {
        return new MyTableModel(null, CUSTOMER_COLUMN_NAMES);
    }
}

class MyTableModel extends DefaultTableModel {

    public MyTableModel(Vector<Vector<String>> data, Vector<String> columnNames) {
        super(data, columnNames);

    }

    public boolean isCellEditable(int row, int column) {
        return false;
    }

    public boolean getColumnSelectionAllowed() {
        return false;
    }
}
